#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;

int n;
int a[1005],f[1005];


int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		f[i]=1;
		for (int j=1;j<i;j++) if (a[j]<a[i]&&f[j]+1>f[i]) f[i]=f[j]+1;
		ans=max(ans,f[i]);
	}
	printf("%d",ans);
    return 0;
}
